package org.example.project.bookstore.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.bean.Category;
import org.example.mapper.CateGoryMapper;
import org.example.project.bookstore.service.CateGoryService;
import org.example.util.JsonResult;
import org.example.util.ResultTool;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @Auther:Liu
 * @Testname:CateGoryServiceimpl
 * @Date:2025/8/18 9:42
 */
@Service
public class CateGoryServiceimpl extends ServiceImpl<CateGoryMapper, Category> implements CateGoryService {


    /**
     *筛选部分分类
     */
    @Cacheable(cacheNames = "findCateGory",key = "#limit")
    public JsonResult findCateGory(int limit) {
        QueryWrapper<Category> wrapper = new QueryWrapper<>();
        wrapper.last("limit "+limit);
        // wrapper.last("limit"+limit); mysql异常
        return ResultTool.success(list(wrapper));
    }
}
